

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.*,Beans.ThamSoHT,Models.ThamSoHT_Model, Models.DauBep_Model, Models.MonAn_Model, Models.DonViTinh_Model, Models.TuyChon_Model"%>

<script type="text/javascript">
    function keypress(e){
        //Hàm dùng để ngăn người dùng nhập các ký tự khác ký tự số vào TextBox
        var keypressed = null;
        if (window.event)
        {
            keypressed = window.event.keyCode; //IE
        }
        else
        {
            keypressed = e.which; //NON-IE, Standard
        }
        if (keypressed < 48 || keypressed > 57 )
        { //CharCode của 0 là 48 (Theo bảng mã ASCII)
            //CharCode của 9 là 57 (Theo bảng mã ASCII)
            if (keypressed == 8 || keypressed == 127  )
            {//Phím Delete và Phím Back
                return;
            }
            return false;
        }
    }
</script>

<%
            int langid = (Integer) session.getAttribute("langid"); // ngôn ngữ hiện tại
            String dsts = " 'assign', 'print', 'all', 'nofood', 'notice', 'notes', 'quantity', 'status', 'rightmsg', 'order', 'unit', 'food', 'table', 'area', 'timehistory', 'foodlist' ";
            ThamSoHT[] mdsts = ThamSoHT_Model.DSThamSo(dsts, langid); // mảng chứa các tham số của trang này.

            String all = mdsts[0].getTenTS();
            String area = mdsts[1].getTenTS();
            String assign = mdsts[2].getTenTS();
            String food = mdsts[3].getTenTS();
            String foodlist = mdsts[4].getTenTS();
            String nofood = mdsts[5].getTenTS();
            String notes = mdsts[6].getTenTS();
            String notice = mdsts[7].getTenTS();
            String order = mdsts[8].getTenTS();
            String print = mdsts[9].getTenTS();
            String quantity = mdsts[10].getTenTS();
            String rightmsg = mdsts[11].getTenTS();
            String status = mdsts[12].getTenTS();
            String table = mdsts[13].getTenTS();
            String timehistory = mdsts[14].getTenTS();
            String unit = mdsts[15].getTenTS();

            String msgright = notice + "/" + rightmsg;
            Vector v = (Vector) request.getAttribute("DSMA");
            Vector vkv = (Vector) request.getAttribute("DSKV");
            Vector vDSTTMA = (Vector) request.getAttribute("DSTTMA");
            String count = (String) request.getAttribute("count");
            int total = 0;
            int totalht = 0;
%>
<script type="text/javascript">    
    jQuery(document).ready(function() {        
        if(id != null){
            clearInterval(id);
            id = null;
        }
        if(idd == null){
            idd = setInterval( "Cook3()", 2000 );
        } 
    });
</script>
<script type="text/javascript">
    $().ready(function() {
        $('select.makv').click(function(){
            clearInterval(idd);
            idd = null;
        });
        $('select.mattma').click(function(){
            clearInterval(idd);
            idd = null;
        });
    });
</script>
<form name="frmcook" id="frmcook" action="" method="Post" target="_blank">
    <div class="title">
        <%=foodlist%>        
        <a onclick="InPhieuCook(this.name)" name="<%=msgright%>" title="<%=print%>" style="float: right; margin-top: 1px; cursor: pointer;" lang="<%=msgright%>"><img style="height: 32px; width: 32px; " alt="" src="../images/print.png"></a>
        <div onclick="Cook3()" lang="<%=msgright%>" id="3" style="float: right;margin-top: 6px; " class="ttmacook ttmacook3" title="<%=DauBep_Model.LayTenTTMA("3", langid)%>"></div>
        <div id="hoithuc" style="float: right;margin-top: -1px; margin-right: 20px; position: relative;">
        <%  if(count.equals("0")){%>
                <img style=" cursor: pointer; opacity: 0.5; margin-top: 8px;" alt="" src="../images/hoithuc.png">
        <%  }
            else{%>
                <div class = 'hoithuc' onclick='ShowHoiThuc()'><%=count%></div>
                <input type="hidden" id="layht" value="<%=count%>">
                <div id="rshoithuc" style=" width: 230px; margin-left: -94px; padding-bottom: 5px;">
                <%  Vector vDSHoiThuc = (Vector) request.getAttribute("DSHoiThuc");
                    for(int i=0; i<vDSHoiThuc.size(); i++){
                        Beans.DauBep bb = (Beans.DauBep) vDSHoiThuc.elementAt(i);
                        totalht = totalht + 1;%>
                        <div style="width: 20px;" class="mahoithuc"><input type="checkbox" onclick="CheckboxCookHT()" class="<%=bb.getMaCTHDT()%>" name="chkcookht" value="<%=bb.getMaMA()%>" alt="<%=bb.getSoLuong()%>" id="<%=bb.getMaDVT()%>" lang="<%=bb.getGhiChu()%>"></div>
                        <div class="mahoithuc"><%=bb.getTenMA() %></div>
                        <div onclick="BoQuaHoiThuc(this.align, this.lang)" align="<%=bb.getMaCTHDT()%>" lang="<%=msgright%>" style=" margin-right: 0px; height: 20px; width: 30px; float: left; cursor: pointer; border-top: 1px solid #959494;"><img style=" height: 20px; width: 20px; margin-top: 7px;" alt="" src="../images/del1.png"></div>
                        <div class="cb"></div>
                <%  }%>
                <input type="hidden" id="totalht" value="<%=totalht %>">
                <a onclick="PhanCongHT()" class="phancong" style=" color: #fff;"><%=assign%></a>
                </div>
        <%  }%>
        </div>
        <div style="float: right;margin-top: 2px; margin-right: 20px; display: none;"><img style=" height: 30px; width: 30px; cursor: pointer; opacity: 0.3;" alt="" src="../images/chat.png"></div>
    </div>
    <div class="content">
        <table class="mytable" border="0" cellpadding="0" cellspacing="0">
            <thead>
                <tr>
                    <th style="width: 4%;  "><%=order%></th>
                    <th style="width: 11%; ">
                        <a href="#" id="titledskv1" style="margin-top: 5px;" >
                            <div style="float:left"><%=timehistory%></div>
                            <div id="sortkv1" style=" margin-right: 30px; display: none;" class="down1"></div>
                        </a>
                    </th>
                    <th style="width: 10%; ">
                        <a href="#" id="titledskv2" style="margin-top: 5px;" >
                            <div style="float:left"><%=area%></div>
                            <div id="sortkv2" style=" margin-right: 30px; display: none;" class="down1"></div>
                        </a>
                    </th>
                    <th style="width: 7%; ">
                        <a href="#" id="titledskv3" style="margin-top: 5px;" >
                            <div style="float:left"><%=table%></div>
                            <div id="sortkv3" style=" margin-right: 25px; display: none;" class="down1"></div>
                        </a>
                    </th>
                    <th style="width: 16%; ">
                        <a href="#" id="titledskv4" style="margin-top: 5px;" >
                            <div style="float:left"><%=food%></div>
                            <div id="sortkv4" style=" margin-right: 60px; display: none;" class="down1"></div>
                        </a>
                    </th>
                    <th style="width: 10%; ">
                        <a href="#" id="titledskv5" style="margin-top: 5px;" >
                            <div style="float:left"><%=unit%></div>
                            <div id="sortkv5" style=" margin-right: 15px; display: none;" class="down1"></div>
                        </a>
                    </th>
                    <th style="width: 9%; ">
                        <a href="#" id="titledskv6" style="margin-top: 5px;" >
                            <div style="float:left"><%=quantity%></div>
                            <div id="sortkv6" style=" margin-right: 20px; display: none;" class="down1"></div>
                        </a>
                    </th>
                    <th style="width: 19%; ">
                        <a href="#" id="titledskv7" style="margin-top: 5px;" >
                            <div style="float:left"><%=notes%></div>
                        </a>
                    </th>
                    <th style=" ">
                        <a href="#" id="titledskv8" style="margin-top: 5px;" >
                            <div style="float:left"><%=status%></div>
                            <div id="sortkv8" style=" margin-right: 60px; display: none;" class="down1"></div>
                        </a>
                    </th>
                </tr>
                <tr id="searchCook" style=" display: none;">
                    <th><img alt="" style=" margin-top: 2px; margin-left: 3px; margin-bottom: -7px; cursor: pointer;" lang="<%=msgright%>" src="../images/search1.png" onclick="SearchCook( this.lang)"></th>
                    <th></th>
                    <th>
                        <select class="makv" onchange="SearchCook(this.lang)"  lang="<%=msgright%>" >
                            <option value="all"><%=all%></option>
                            <%
                                        for (int i = 0; i < vkv.size(); i++) {
                                            Beans.KhuVuc kv = (Beans.KhuVuc) vkv.elementAt(i);%>
                            <option value="<%=kv.getMaKV()%>"><%=kv.getTenKV()%></option>
                            <%  }%>
                        </select>
                    </th>
                    <th><input type="textbox" style="width: 50px;" class="text tenban"  onkeypress="return keypress(event)"></th>
                    <th><input type="textbox" style="width: 130px;" class="text tenma" ></th>
                    <th><input type="textbox" style="width: 90px;" class="text tendvt"></th>
                    <th><input type="textbox" style="width: 50px;" class="text soluong" onkeypress="return keypress(event)"></th>
                    <th></th>
                    <th>
                        <select class="mattma" onchange="SearchCook(this.lang)"  lang="<%=msgright%>" >
                            <option value="all"><%=all%></option>
                            <%
                                        for (int i = 0; i < vDSTTMA.size(); i++) {
                                            Beans.TinhTrangMA tt = (Beans.TinhTrangMA) vDSTTMA.elementAt(i);%>
                            <option value="<%=tt.getMaTTMA()%>"><%=tt.getTenTTMA()%></option>
                            <%  }%>
                        </select>
                    </th>
                </tr>
            </thead>
            <tbody>
                <%
                            for (int i = 0; i < v.size(); i++) {
                                Beans.DauBep b = (Beans.DauBep) v.elementAt(i);
                                total = total + 1;
                %>
                <tr>
                    <td><input type="checkbox" onclick="CheckboxCook3()" name="chkcook" value="<%=b.getMaMA()%>" alt="<%=b.getSoLuong()%>" id="<%=b.getMaDVT()%>" lang="<%=b.getGhiChu()%>"></td>
                    <td><%=b.getNgayGio() %></td>
                    <td><%=b.getTenKV() %></td>
                    <td><%=b.getTenBan() %></td>
                    <td><%=b.getTenMA()%></td>
                    <td><%=b.getTenDVT() %></td>
                    <td style=" padding-left: 15px;"><%=b.getSoLuong()%></td>
                    <td style="padding-right: 5px;"><%=b.getGhiChu()%></td>
                    <td>
                        <div onclick="UpdateTTMACook3(this.align, this.id, this.lang)" align="<%=b.getMaCTHDT()%>" lang="<%=msgright%>" id="1" class="ttmacook ttmacook1" style="opacity:0.30; " title="<%=DauBep_Model.LayTenTTMA("1", langid)%>" ></div>
                        <div onclick="UpdateTTMACook3(this.align, this.id, this.lang)" align="<%=b.getMaCTHDT()%>" lang="<%=msgright%>" id="2" class="ttmacook ttmacook2" style="  opacity: 0.30;"  title="<%=DauBep_Model.LayTenTTMA("2", langid)%>" ></div>
                        <div onclick="UpdateTTMACook3(this.align, this.id, this.lang)" align="<%=b.getMaCTHDT()%>" lang="<%=msgright%>" id="3" class="ttmacook ttmacook3"   title="<%=DauBep_Model.LayTenTTMA("3", langid)%>" ></div>
                            
                    </td>
                </tr>
                <%}%>
                <input type="hidden" value="<%=total%>" id="total">
            </tbody>
        </table>
    </div>
</form>

